package com.cx.service.impl;

import com.cx.mapper.BrandMapper;
import com.cx.pojo.Brand;
import com.cx.pojo.CarInfoModel;
import com.cx.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandServiceImpl implements BrandService {
    @Autowired
    BrandMapper brandMapper;

    @Override
    public int insert(Brand brand) {
        return brandMapper.insert(brand);
    }

    @Override
    public int deleteByPrimaryKey(Integer brandId) {
        return brandMapper.deleteByPrimaryKey(brandId);
    }

    @Override
    public int updateByPrimaryKey(Brand brand) {
        return brandMapper.updateByPrimaryKey(brand);
    }

    @Override
    public Brand selectByPrimaryKey(Integer brandId) {
        return brandMapper.selectByPrimaryKey(brandId);
    }

    //查询所有汽车品牌
    @Override
    public List<Brand> selectAll(Brand brand) {
        List<Brand> brands = brandMapper.selectAll(brand);
        return brands;
    }

    //根据品牌查询汽车
    @Override
    public List<CarInfoModel> selectBrandByBrandName(String brandName) {
        List<CarInfoModel> carInfoModelList = brandMapper.selectBrandByBrandName(brandName);
        return carInfoModelList;
    }

    @Override
    public Brand selectBrand(String brandName) {
        Brand brands = brandMapper.selectBrand(brandName);
        return brands;
    }

}
